其他
Stata:面板分位数及工具变量分析
面板分位数回归及Stata实现
简介
面板数据分位数回归所使用到的命令是qregpd,由于这是一个外部命令,因此首先需要先下载安装,我们来看一下下载安装出来的这样的一个结果
qregpd depvar indepvars [if] [in] [weight] , [quantile(#) instruments(varlist) identifier(varlist) fix(varlist) optimize(string) MCMC options Grid-search options ]
选项含义为:
depvar表示被解释变量
indepvars表示解释变量
[if]表示条件语句
[in]表现范围语句
[weight]表示权重
quantile(#)设置分位数,取值范围是0--1,默认为0.5,中位数。
identifier(varlist)设置个体变量名
fix(varlist)设置时点固定效应
optimize(string) 在估计qregpd时, Nelder-Mead (default)默认,自适应MCMC和 Grid-search
面板分位数回归案例
以Stata数据集为例来进行面板数据分位数回归的案例操作。该数据研究的是任职职位、工会组织对工资水平的影响。
# 该数据与Stata高级班中A10面板数据专题数据一致
use "C:\Users\admin\Desktop\wage1810.dta", clear
xtset idcode year
desc
qregpd ln_wage tenure union, id(idcode) fix(year)
结果为:
xtset idcode year
panel variable: idcode (unbalanced)
time variable: year, 68 to 88, but with gaps
delta: 1 unit
.
. desc
Contains data from E:\2022年8月Stata课程2022.08.13--2022.08.15\Stata-202208\A4_panel\w
> age1810.dta
obs: 28,534 National Longitudinal Survey. Young
Women 14-26 years of age in 1968
vars: 13 21 Mar 2010 20:49
size: 684,816
--------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
--------------------------------------------------------------------------------------
idcode int %8.0g NLS ID
year byte %8.0g interview year
age byte %8.0g age in current year
race byte %8.0g 1=white, 2=black, 3=other
msp byte %8.0g 1 if married, spouse present
grade byte %8.0g current grade completed
not_smsa byte %8.0g 1 if not SMSA
south byte %8.0g 1 if south
union byte %8.0g 1 if union
ttl_exp float %9.0g total work experience
tenure float %9.0g job tenure, in years
hours int %8.0g usual hours worked
ln_wage float %9.0g ln(wage/GNP deflator)
--------------------------------------------------------------------------------------
Sorted by: idcode year
.
. qregpd ln_wage tenure union, id(idcode) fix(year)
Nelder-Mead optimization
initial: f(p) = -298.32357
rescale: f(p) = -1.2889814
Iteration 0: f(p) = -1.2889814
Iteration 1: f(p) = -1.2889814
Iteration 2: f(p) = -1.2889814
Iteration 3: f(p) = -1.2889814
Iteration 4: f(p) = -1.2889814
Iteration 5: f(p) = -1.2889814
Iteration 6: f(p) = -1.2889814
Iteration 7: f(p) = -1.2889814
Iteration 8: f(p) = -1.2889814
Iteration 9: f(p) = -1.2889814
Iteration 10: f(p) = -.657829
Iteration 11: f(p) = -.657829
Iteration 12: f(p) = -.57754087
Iteration 13: f(p) = -.02146447
Iteration 14: f(p) = -.00537403
Iteration 15: f(p) = -.00537403
Iteration 16: f(p) = -.00171472
Iteration 17: f(p) = -.00164654
Iteration 18: f(p) = -.00164654
Iteration 19: f(p) = -.00164654
Iteration 20: f(p) = -.00164654
Iteration 21: f(p) = -.00164654
Iteration 22: f(p) = -.00164654
Quantile Regression for Panel Data (QRPD)
Number of obs: 19010
Number of groups: 4134
Min obs per group: 1
Max obs per group: 12
------------------------------------------------------------------------------
ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tenure | .0207086 .0018148 11.41 0.000 .0171516 .0242656
union | .0922599 .0122956 7.50 0.000 .068161 .1163588
-----------------------------------------------------------------------------
No excluded instruments - standard QRPD estimation.
.
结果表面,在1%的显著性水平下,工作任期每增加1个单位,可以带来工资增长约2.07%,加入工会可以提高工人工资约9.23%。
面板分位数MCMC方法
Same as above, but using MCMC methods
. qregpd ln_wage tenure union, id(idcode) fix(year) optimize(mcmc) noisy draws(1000) burn(100) arate(.5)
. mat list e(gamma)
面板分位数工具变量分析
Robust instrumental variable quantile regression for panel data. MCMC optimization.
. qregpd ln_wage tenure union, id(idcode) fix(year) optimize(mcmc) noisy draws(1000) burn(100) arate(.5) instruments(ttl_exp wks_work union)
. mat list e(gamma)